<style lang="less">
  @import "../styles/common";

  .tablePrint,
  .tablePrint tr th,
  .tablePrint tr td {
    border: 2px solid #8a8e8e;
    padding: 15px 0;
    color: #000;
  }

  .tablePrint thead tr {
    font-weight: normal;
  }

  .tablePrint thead tr th {
    padding: 15px 0;
    font-weight: normal;
  }

  .tablePrint {
    width: 750px;
    margin-top: 20px;
    text-align: center;
    border-collapse: collapse;
    padding: 2px;
    font-size: 14px;
  }

  .page {
    margin-top: 10px;
    margin-bottom: 20px;
    // box-shadow: #cccccc 3px 3px 8px 0px;
    position: relative;
    left: 52%;
    margin-left: -130mm;
    box-sizing: border-box;
    padding: 15mm 8mm;
    width: 250mm;
    min-height: 297mm;
    background: #ffffff;
    font-size: 12px;
    color: #000000;
  }

  .debitTitle {
    margin-top: 10px;
    font-weight: normal;
    text-align: center;
    font-size: 25px;
  }

  .print-form-label-debit {
    width: 100%;
    word-wrap: break-word;
    word-break: break-all;
    line-height: 24px;
    text-align: right;
  }

  .print-form-left-label-debit {
    width: 100%;
    min-height: 24px;
    word-wrap: break-word;
    word-break: break-all;
    line-height: 24px;
    text-align: left;
  }

  .split-line-debit {
    margin: 5px 0px;
    height: 1px;
    border-bottom: solid 2px black;
  }

  .debit-line {
    left: 50%;
    width: 240px;
    margin-left: -120px;
    position: relative;
    height: 1px;
    border-bottom: solid 1px black;
  }

  .ivu-col-padding {
    padding-left: 10px;
    box-sizing: border-box;
  }

  .ivu-col-margin {
    margin-left: -15px;
  }

  .border-bottom-line-debit {
    border-bottom: solid 1px black;
    margin-left: 8px !important;
    padding-bottom: 2.5px;
    padding-top: 2.5px;
  }

  .footer {
    text-align: center;
    font-size: 18px;
    font-weight: 400;
    margin-top: 150px;
    padding-left: 270px;
  }

  .input-border {
    outline: none;
  }

  .input-border .ivu-input {
    border: none;
    border-bottom: 1px solid #3b3b3b
  }

  .margin-left-5 {
    margin-left: 5px;
  }

  .input-border:focus {
    outline: 3px solid rgba(97, 205, 255, .5);
    -webkit-border-radius: 2px 2px;
    -moz-border-radius: 2px 2px;
    border-radius: 2px 2px;
  }
</style>
<template>
  <default-page-box>
    <template slot="tools-bar">
      <Button type="primary" size="small" @click="onPrint">打印</Button>
      <Button type="primary" size="small" class="button-space" @click="exitPage">退出</Button>
    </template>
    <template slot="content">
      <div id="printPages">
        <div class="page">
          <div style="width: 150px;height: 130px;margin-top: -60px; position: relative;">
            <img :src="require('./logo.png')"
                 style="max-height:100%; max-width:100%; height:auto; width:auto; position: absolute; top: 50%;"
                 alt="logo"/>
          </div>
          <!--<div style="height: auto;overflow:auto;text-align: center; font-size: 25px">{{ printName }}</div>-->
          <div style="height: auto;overflow:auto;text-align: center; font-size: 25px">入库单</div>
          <div style="margin-left: 20px">
            <Row style="font-size: 14px;margin-top: 45px">
              <i-col span="2" style="text-align: left;">
                <div>客户名称：</div>
              </i-col>
              <i-col span="14" style="text-align: left;">
                <div style="width: 100%;height: 20px;">{{
                  $handleFormatter(
                  headFormItem.customerCode,
                  customerCodeList,
                  'customerCode',
                  'customerName'
                  )
                  }}
                </div>
              </i-col>
            </Row>
            <Row style="font-size: 14px; margin-top: 20px">
              <i-col span="2" style="text-align: left">
                <div>仓库地址：</div>
              </i-col>
              <i-col span="18" style="text-align: left">
                <div style="width: 100%;height: 20px;">入库单</div>
                <!--<div style="width: 100%;height: 20px;">{{ printAddress }}</div>-->
              </i-col>
            </Row>
            <Row style="font-size: 14px;margin-top: 20px">
              <i-col span="2" style="text-align: left">
                <div>仓库电话：</div>
              </i-col>
              <i-col span="18" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ phone }}</div>
              </i-col>
            </Row>
            <Row style="font-size: 14px;margin-top: 20px">
              <i-col span="2" style="text-align: left">
                <div>送货车号：</div>
              </i-col>
              <i-col span="6" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.carNo }}</div>
              </i-col>
              <i-col span="2" style="text-align: left">
                <div>送货司机：</div>
              </i-col>
              <i-col span="6" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.driver }}</div>
              </i-col>
              <i-col span="2" style="text-align: left">
                <div>司机电话：</div>
              </i-col>
              <i-col span="4" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.tel }}</div>
              </i-col>
            </Row>
            <Row style="font-size: 14px; margin-top: 20px">
              <i-col span="2" style="text-align: left">
                <div>集装箱号：</div>
              </i-col>
              <i-col span="6" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.businessItem }}</div>
              </i-col>
              <i-col span="2" style="text-align: left">
                <div>铅封号：</div>
              </i-col>
              <i-col span="5" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.leadSealNum }}</div>
              </i-col>
              <i-col span="3" style="text-align: left">
                <div>业务归属日：</div>
              </i-col>
              <i-col span="6" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.businessDate }}</div>
              </i-col>
            </Row>
          </div>
          <table class="tablePrint" style="margin-top: 40px;margin-left: 30px">
            <thead>
            <tr>
              <th width="50">序号</th>
              <th width="80">品名</th>
              <th width="50">规格</th>
              <th width="80">计划件数(件)</th>
              <th width="80">实际件数(件)</th>
              <th width="50">重量(KG)</th>
              <th width="50">原产国</th>
              <th width="50">生产日期</th>
              <th width="50">打包配置</th>
              <th width="50">备注</th>
            </tr>
            </thead>
            <tbody>
            <tr v-for="(item, index) in data" :key="index">
              <td>{{ index + 1 }}</td>
              <td>{{ item.matName }}</td>
              <td>{{ $formatterDict(item.isBulkCargo, packageList) }}</td>
              <td>{{ item.orderQty }}</td>
              <td>{{ item.finishQty }}</td>
              <td>{{ item.orderWeight }}</td>
              <td>{{ item.country }}</td>
              <td>{{ handleDate(item.dateGen) }}</td>
              <td>{{ item.packConfig }}</td>
              <td>{{ item.remark }}</td>
            </tr>
            <tr>
              <td>合计</td>
              <td></td>
              <td></td>
              <td>{{ orderQtySum }}</td>
              <td>{{ finishQtySum }}</td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
            </tr>
            </tbody>
          </table>
          <div style="clear: both;margin-top: 10px"></div>
          <div style="margin-top: 40px; font-size: 14px;margin-left: 20px">
            <div>
<!--              <div style="float: left">-->
<!--                <span>实际入库件数：</span>-->
<!--                <span><Input class="input-border" size="small" style="width: 100px;"-->
<!--                             v-model="formItem.actualOrderNum"></Input></span>-->
<!--                <span class="margin-left-5">件</span>-->
<!--              </div>-->
              <div style="clear: both;height: 20px"></div>
              <div style="float: left;display: flex">
                <span>其他服务：</span>
                <span style="display: flex;flex-direction: column;">
                  <span>
                    <Checkbox
                      v-model="formItem.separation"
                      size="small"
                      style="font-size: 14px"
                    >分色</Checkbox>
                    <Checkbox
                      v-model="formItem.code"
                      size="small"
                      style="font-size: 14px"
                    >抄码</Checkbox>
                        <Checkbox
                          v-model="formItem.weigh"
                          size="small"
                          style="font-size: 14px"
                        >称重</Checkbox>
                    <Checkbox
                      v-model="formItem.other"
                      size="small"
                      style="font-size: 14px"
                    >其他</Checkbox>
                  </span>
                </span>
              </div>
              <div style="clear: both;height: 20px"></div>
              <div style=" clear:both;">
                <div style="float: left">
                  <span>货物异常：</span>
                  <span>
                  <Checkbox
                    v-model="formItem.multi"
                    size="small"
                    style="font-size: 14px"
                  >多件</Checkbox>
                    <Checkbox
                      v-model="formItem.single"
                      size="small"
                      style="font-size: 14px"
                    >少件</Checkbox>
                </span>
                  <span><Input class="input-border margin-left-5" size="small" style="width: 100px;"
                               v-model="formItem.orderNum"></Input></span>
                  <span class="margin-left-5">件</span>
                  <span style="margin-left: 150px">坏箱数量：</span>
                  <span><Input class="input-border margin-left-5" size="small" style="width: 100px;"
                               v-model="formItem.noOrderNum"></Input></span>
                  <span class="margin-left-5">件</span>
                </div>
              </div>
              <div style="clear: both;height: 20px"></div>
              <div style="float: left;clear:both;">
                <div>
                  <span>测温温度(℃)：</span>
                  <span><Input class="input-border" size="small" style="width: 100px;"
                               v-model="headFormItem.containerTemperature"></Input></span>
                  <span style="margin-left: 150px">商品储存方式：</span>
                  <span><Input class="input-border" size="small" style="width: 100px;"
                               v-model="headFormItem.temperatureName"></Input></span>
                </div>
              </div>
              <div style="clear: both;height: 20px"></div>
              <div style="float: left;margin-top: 10px; clear:both;">
                <span>制单员：</span>
                <span><Input class="input-border" size="small" style="width: 100px;"
                             v-model="headFormItem.userName"></Input></span>
              </div>
              <div style="clear: both;height: 20px"></div>
              <div style="float: left; clear:both;margin-top: 40px">
                <span>叉车签字：</span>
                <span><Input class="input-border" size="small" style="width: 100px;"
                             v-model="formItem.truckSign"></Input></span>
                <span style="margin-left: 150px">司机签字：</span>
                <span><Input class="input-border" size="small" style="width: 100px;"
                             v-model="formItem.driverName"></Input></span>
              </div>
              <div style="clear: both;height: 20px"></div>
              <div style="float: left;margin-top: 40px; clear:both;">
                <span>理货员签字：</span>
                <span><Input class="input-border" size="small" style="width: 100px;"
                             v-model="formItem.tallySign"></Input></span>
                <span style="margin-left: 135px">装卸签字：</span>
                <span><Input class="input-border" size="small" style="width: 100px;"
                             v-model="formItem.sendUserName"></Input></span>
              </div>
            </div>
          </div>
          <div style="width: 317px;height: 283px;margin-left: 570px;margin-top: -100px">
            <img :src="require('./bottom.png')" style="width: 100%; height: 100%"/>
          </div>
          <div style="font-size: 14px; margin-top: -60px;margin-left: 20px">
            注：以上签字确认视为对实际重量与数量无疑义。
          </div>
        </div>
      </div>
      <div id="printPageTS" v-show="false">
        <div class="page">
          <div style="width: 150px;height: 130px;">
            <img :src="require('./logo.png')" style="max-height:100%; max-width:100%; height:auto; width:auto;" alt="logo"/>
          </div>
          <!--<div style="height: auto;overflow:auto;margin-top: -70px;text-align: center; font-size: 25px">{{ printName }}</div>-->
          <div style="height: auto;overflow:auto;margin-top: -70px;text-align: center; font-size: 25px">入库单</div>
          <div style="clear: both;height: 45px;"></div>
          <div style="margin-top: 20px; clear: both;margin-left: 20px">
            <Row style="font-size: 14px;">
              <i-col span="3" style="text-align: left;">
                <div>客户名称：</div>
              </i-col>
              <i-col span="21" style="text-align: left;">
                <div style="width: 100%;height: 20px;">{{
                  $handleFormatter(
                  headFormItem.customerCode,
                  customerCodeList,
                  'customerCode',
                  'customerName'
                  )
                  }}
                </div>
              </i-col>
            </Row>
          </div>
          <div style="clear: both;margin-top: 20px; font-size: 14px;margin-left: 20px">
            <i-col span="3">
              <div>仓库地址：</div>
            </i-col>
            <i-col span="21" style="text-align: left">
              <div style="width: 100%;height: 20px;">{{ printAddress }}</div>
            </i-col>
          </div>
          <div style="margin-top: 20px; clear: both"></div>
          <div style="clear: both;margin-top: 40px; font-size: 14px;margin-left: 20px">
            <i-col span="3">
              <div>仓库电话：</div>
            </i-col>
            <i-col span="21" style="text-align: left">
              <div style="width: 100%;height: 20px;">{{ phone }}</div>
            </i-col>
          </div>
          <div style="margin-top: 20px; clear: both"></div>
          <div style="clear: both;margin-top: 40px;margin-left: 20px">
            <Row style="font-size: 14px;">
              <i-col span="3" style="text-align: left;">
                <div>送货车号：</div>
              </i-col>
              <i-col span="5" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.carNo }}</div>
              </i-col>
              <i-col span="3" style="text-align: left;">
                <div>送货司机：</div>
              </i-col>
              <i-col span="5" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.driver }}</div>
              </i-col>
              <i-col span="5" style="text-align: left;;">
                <div>司机电话：</div>
              </i-col>
              <i-col span="3" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.tel }}</div>
              </i-col>
            </Row>
            <Row style="font-size: 14px;margin-top: 20px;">
              <i-col span="3" style="text-align: left;">
                <div>集装箱号：</div>
              </i-col>
              <i-col span="5">
                <div style="width: 100%;height: 20px;text-align: left">{{ headFormItem.businessItem }}</div>
              </i-col>
              <i-col span="3" style="text-align: left;">
                <div>铅封号：</div>
              </i-col>
              <i-col span="4" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.leadSealNum }}</div>
              </i-col>
              <i-col span="4" style="text-align: left;">
                <div>业务归属日：</div>
              </i-col>
              <i-col span="5" style="text-align: left">
                <div style="width: 100%;height: 20px;">{{ headFormItem.businessDate }}</div>
              </i-col>
            </Row>
          </div>
          <table class="tablePrint" style="margin-top: 40px;margin-left: 30px">
            <thead>
            <tr>
              <th width="50">序号</th>
              <th width="50">品名</th>
              <th width="50">规格</th>
              <th width="50">件数</th>
              <th width="50">重量(KG)</th>
              <th width="50">原产国</th>
              <th width="50">生产日期</th>
              <th width="50">打包配置</th>
              <th width="50">备注</th>
            </tr>
            </thead>
            <tbody v-for="(item, index) in data" :key="index">
            <tr>
              <td width="50">{{ index + 1 }}</td>
              <td width="50">{{ item.matName }}</td>
              <td width="50">{{ item.packFormat }}</td>
              <td width="50">{{ item.orderQty }}</td>
              <td width="50">{{ item.orderWeight }}</td>
              <td width="50">{{ item.country }}</td>
              <td width="50">{{ handleDate(item.dateGen) }}</td>
              <td width="50">{{ item.packConfig }}</td>
              <td width="50">{{ item.remark }}</td>
            </tr>
            </tbody>
          </table>
          <div style="margin-top: 30px; font-size: 14px;margin-left: 20px">
            <Row>
              <span>实际入库件数：</span>
              <span style="margin-left: 10px">{{ formItem.actualOrderNum }} 件</span>
            </Row>
            <div style="margin-top: 20px">
              <span>其他服务：</span>
              <span style="margin-left: 10px">
                       <input type="checkBox" id="separation" v-model="formItem.separation" size="small"
                              style="font-size: 14px;"></input> 分色
                    </span>
              <span style="margin-left: 10px">
                       <input type="checkBox" id="code" v-model="formItem.code" size="small"
                              style="font-size: 14px;"></input> 抄码
                   </span>
              <span style="margin-left: 10px">
                        <input type="checkBox" id="weigh" v-model="formItem.weigh" size="small"
                               style="font-size: 14px;"></input> 称重
                   </span>
              <span style="margin-left: 10px">
                       <input type="checkBox" id="other" v-model="formItem.other" size="small"
                              style="font-size: 14px;"></input> 其他
                   </span>
            </div>
            <div style="margin-top: 20px;">
              <span>货物异常：</span>
              <span style="margin-left: 10px">
                       <input type="checkBox" id="multi" v-model="formItem.multi" size="small"
                              style="font-size: 14px;"></input> 多件
                   </span>
              <span style="margin-left: 10px">
                       <input type="checkBox" id="single" v-model="formItem.single" size="small"
                              style="font-size: 14px;"></input> 少件
                   </span>
              <span style="margin-left: 10px;">
                {{ formItem.orderNum }} 件
              </span>
              <span style="margin-left: 100px">坏箱数量：</span>
              <span style="margin-left: 10px">{{ formItem.noOrderNum }} 件</span>
            </div>
            <div style="margin-top: 20px;">
              <span>测温温度：</span>
              <span style="margin-left: 10px">{{ headFormItem.containerTemperature }} ℃</span>
              <span style="margin-left: 100px">商品储存方式：</span>
              <span style="margin-left: 10px">{{ headFormItem.temperatureName }}</span>
            </div>
            <div style="margin-top: 20px">
              <span>制单员：</span>
              <span style="margin-left: 10px">{{ headFormItem.userName }}</span>
            </div>
            <div style="margin-top: 60px">
              <span>叉车签字：</span>
              <span style="margin-left: 10px">{{ formItem.truckSign }}</span>
              <span style="margin-left: 100px">司机签字：</span>
              <span style="margin-left: 10px">{{ formItem.driverName }}</span>
            </div>
            <div style="margin-top: 60px">
              <span>理货员签字：</span>
              <span style="margin-left: 10px">{{ formItem.tallySign }}</span>
              <span style="margin-left: 85px">装卸签字：</span>
              <span style="margin-left: 10px">{{ formItem.sendUserName }}</span>
            </div>
            <div style="width: 317px;height: 283px;margin-left: 420px;margin-top: -150px">
              <img :src="require('./bottom.png')" style="width: 100%; height: 100%"/>
            </div>
            <div style="font-size: 14px;margin-top: -60px">
              注：以上签字确认视为对实际重量与数量无疑义。
            </div>
          </div>
        </div>
      </div>
    </template>
  </default-page-box>
</template>
<script>
  import util from '@/libs/handleUtil';
  import timeUtil from '@/libs/timeUtil';
  import {getByCustomerType, printNewInPlan} from '@/api/outInto';
  import {getAllType} from '@/api/area';
  import DefaultPageBox from '@/components/page/default-page-box/index';

  export default {
    components: {
      DefaultPageBox
    },
    name: 'into-plan-print',
    props: {
      wmsUrl: {
        type: String,
        default: ''
      },
      TCorderNum: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        data: [],
        headFormItem: {},
        templateHtml: '',
        printName: '',
        printAllName: '',
        printAddress: '',
        phone: '',
        footerName: '',
        createdDate: '',
        businessTypeList: [],
        customerCodeList: [],
        // imgSrc: config.baseUrl.pro + '/hezeyuan-logo.png',
        imgSrc: './logo.png',
        bottomSrc: './bottom.png',
        formItem: {
          actualPalletNum: '', // 实际托数量
          actualBoxNum: '', // 实际箱数量
          actualOrderNum: '', // 实际件数量
          boxNum: '', // 数量差异箱
          orderAllWeight: '',
          orderAllOutNum: '',
          orderNum: '', // 件
          noBoxNum: '',
          noOrderNum: '',
          inActualTer: '', // 产品入库实测温度
          startOutGood: '', // 开始卸货时间
          endOutOrder: '', // 完成卸货时间
          getUserName: '',
          userDate: '',
          sendUserName: '',
          driverName: '',
          senUserDate: '',
          carNo: '',
          carDate: ''
        },
        orderQtySum: 0,
        finishQtySum: 0,
        packageList: []
      };
    },
    methods: {
      changeBorder(event) {
        let input = event.currentTarget;
        input.style.outline = '1px solid #88f2ff';
      },
      blurBorder(event) {
        let input = event.currentTarget;
        input.style.outline = 'none';
        input.style.border = '1px solid #3b3b3b';
      },
      handleDate(date) {
        return timeUtil.timestampDate(date);
      },
      printData() {
        let css = `<style media="print">
                  body {
                      font-family: Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,\\\\5FAE\\8F6F\\96C5\\9ED1,Arial,sans-serif;
                      font-size: 12px;
                  }
                  .tablePrint,
                  .tablePrint tr th,
                  .tablePrint tr td {
                    border: 2px solid #8a8e8e;
                    padding: 15px 0;
                    color: #000;
                  }

                  .tablePrint thead tr {
                    font-weight: normal;
                  }

                  .tablePrint thead tr th {
                    padding: 15px 0;
                    font-weight: normal;
                  }

                  .tablePrint {
                    width: 650px;
                    margin-top: 20px;
                    text-align: center;
                    border-collapse: collapse;
                    padding: 2px;
                    font-size: 14px;
                  }

                  .page {
                          box-sizing: border-box;
                            padding: 15mm;
                            width: 210mm;
                            height: 297mm;
                            background: #ffffff;
                            font-size: 13px;
                            color: #000000;
                  }

                  .title {
                      text-align: center;
                      font-size : 25px;
                  }
                  .desc {
                      text-align: center;
                      font-size: 15px;
                  }
                  .print-form-label {
                      line-height: 24px;
                      text-align: right;
                  }
                   .footer {
                      text-align: center;
                      font-size: 18px;
                      font-weight: 400;
                      margin-top: 150px;
                      padding-left: 270px;
                  }
                  .input-border {
                    border: none;
                    border-bottom: 1px solid #3b3b3b
                  }
                  .margin-left-5 {
                    margin-left: 5px;
                  }
                 @page {
                      size: 210mm 297mm;
                      margin: 0mm;
                      padding: 0mm;
                      box-sizing: border-box;
                 }
            </style>`;
        this.$nextTick(function () {
          // const No = this.printRecord.blNo || this.printRecord.orderNo;
          // const title = No + '费用确认';
          const title = this.$route.query.orderNum + this.printName;
          util.printPage('printPageTS', css, title);
        });
      },
      onPrint() {
        if (this.formItem.separation) {
          document.getElementById('separation').setAttribute('checked', 'checked');
        }
        if (this.formItem.code) {
          document.getElementById('code').setAttribute('checked', 'checked');
        }
        if (this.formItem.weigh) {
          document.getElementById('weigh').setAttribute('checked', 'checked');
        }
        if (this.formItem.other) {
          document.getElementById('other').setAttribute('checked', 'checked');
        }
        if (this.formItem.multi) {
          document.getElementById('multi').setAttribute('checked', 'checked');
        }
        if (this.formItem.single) {
          document.getElementById('single').setAttribute('checked', 'checked');
        }
        this.printData();
      },
      exitPage() {
        this.$router.push({
          path: 'intoPlan'
        });
      },
      getPrintData() {
        this.orderQtySum = 0
        this.finishQtySum = 0
          printNewInPlan(this.TCorderNum, this.$props.wmsUrl).then(response => {
            if (response.data.returnCode === 200) {
              this.data = response.data.returnData.wmsInPlanDetailList;
              let sum1 = 0
              let sum2 = 0
              this.data.map( item=> {
                sum1 = sum1 + (item.orderQty !== undefined && item.orderQty !== null && item.orderQty !== ''? item.orderQty: 0)
                sum2 = sum2 + (item.finishQty !== undefined && item.finishQty !== null && item.finishQty !== ''? item.finishQty: 0)
              })
              this.orderQtySum = sum1
              this.finishQtySum = sum2
              this.headFormItem = response.data.returnData.wmsInPlanDTO;
              this.headFormItem.createdDate = this.handleDate(this.headFormItem.createdDate);
            } else {
              this.$error(response.data.returnMsg, 3);
            }
          }).catch(err => {
            this.$loginOut();
          });
      },
      getFileName() {
        getAllType('PRINT_IN_PLAN_FILE_NAME', this.$props.wmsUrl).then(response => {
          if (response.data.returnCode === 200) {
            this.printName = response.data.returnData[0].dictName;
          } else {
            this.$error(response.data.returnMsg, 3);
          }
        }).catch(err => {
          this.$loginOut();
        });
        getAllType('PRINT_CONTACT', this.$props.wmsUrl).then(response => {
          if (response.data.returnCode === 200) {
            this.phone = response.data.returnData[0].dictName;
          } else {
            this.$error(response.data.returnMsg, 3);
          }
        }).catch(err => {
          this.$loginOut();
        });
        getAllType('PRINT_ADDRESS', this.$props.wmsUrl).then(response => {
          if (response.data.returnCode === 200) {
            this.printAddress = response.data.returnData[0].dictName;
          } else {
            this.$error(response.data.returnMsg, 3);
          }
        }).catch(err => {
          this.$loginOut();
        });
        getAllType('PRINT_TITLE', this.$props.wmsUrl).then(response => {
          if (response.data.returnCode === 200) {
            this.printAllName = response.data.returnData[0].dictName;
          } else {
            this.$error(response.data.returnMsg, 3);
          }
        }).catch(err => {
          this.$loginOut();
        });
        getAllType('PRINT_FOOTER_NAME', this.$props.wmsUrl).then(response => {
          if (response.data.returnCode === 200) {
            this.footerName = response.data.returnData[0].dictName;
          } else {
            this.$error(response.data.returnMsg, 3);
          }
        }).catch(err => {
          this.$loginOut();
        });
      },
      getBusType() {
        getAllType('INTO_BUS_TYPE', this.$props.wmsUrl).then(response => {
          if (response.data.returnCode === 200) {
            this.businessTypeList = response.data.returnData;
          } else {
            this.$error(response.data.returnMsg, 3);
          }
        }).catch(err => {
          this.$loginOut();
        });
      },
      // 获取客户
      getCustomerList() {
        getByCustomerType({customerProperty: 'h'}, this.$props.wmsUrl).then(response => {
          if (response.data.returnCode === 200) {
            this.customerCodeList = response.data.returnData;
          } else {
            this.$error(response.data.returnMsg, 3);
          }
        }).catch(err => {
          this.$loginOut();
        });
      },
      getPackageList() {
        getAllType('PACKAGE_TYPE', this.$props.wmsUrl).then((response) => {
          if (response.data.returnCode === 200) {
            this.packageList = response.data.returnData;
          } else {
            this.$error(response.data.returnMsg, 3)
          }
        }).catch(err => {
          this.$loginOut()
        });
      },
    },
    activated() {
      this.getFileName();
      this.getBusType();
      this.getPrintData();
    },
    mounted() {
      this.getFileName();
      this.getBusType();
      this.getPrintData();
      this.getCustomerList();
      this.getPackageList();
      // window.addEventListener("beforeunload", function (e) {
      //   //不是所有浏览器都支持提示信息的修改
      //   var confirmationMessage = "请先保存您编辑的内容,否则您修改的信息会丢失。";
      //   e.returnValue = confirmationMessage;
      //   return confirmationMessage;
      // })
    }
  };
</script>
